// @Author yy 2024/8/22 定时器批量处理会议剩余事情
package conference_handler

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"log"
	"peilian-api/app/global/databases/tables"
	"peilian-api/app/global/variable"
)

//ProcessDataAndCreateReport
/**
*@author: yy
*@description: 处理会议数据并且生成报告
*@date :2024/8/22 下午5:05
**/
func ProcessDataAndCreateReport(ctx *gin.Context) {
	var conferenceApplies []tables.ConferenceApply
	// 查询当天所有未处理完的数据
	variable.DB.MySQL.Where("un_finish ='0' and un_handle ='0' and DATE(created_at) = CURDATE() ").Find(&conferenceApplies)
	if conferenceApplies == nil || len(conferenceApplies) == 0 {
		log.Printf("当天没有需要处理的数据")
	}

	for _, conferenceApply := range conferenceApplies {
		fmt.Println("遍历查询的数据=====", conferenceApply)
		if conferenceApply.SessionId == 0 {
			log.Printf("学生没有生成面试场次")
			continue
		}
		// 查询本场讨论会该学生回答结果，
		var studentReplyList []tables.ConferenceStudentReply
		variable.DB.MySQL.Where("conference_id = ? and student_id=?", conferenceApply.ConferenceId, conferenceApply.StudentId).Find(&studentReplyList)
		if studentReplyList == nil || len(studentReplyList) == 0 {
			log.Printf("本次讨论会该学生没有回答问题")
			continue
		}
		// 需要把m3u8文件转成mp3格式

	}

}
